﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<script runat="server">

</script>

<!DOCTYPE html>
    
<html>
<head id="Head1" runat="server">
    <title>自由企业管理系统</title>
</head>
<body>
    <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server"/>

       <ext:Window 
            ID="LoginWin" 
            runat="server" 
            Closable="false"
            Resizable="false"
            Height="160" 
            Icon="Lock" 
            Title="登录"
            Draggable="false"
            Width="300"
            Modal="true"
            Layout="FormLayout" 
            Padding="5">
            <Items>
                <ext:TextField 
                    ID="txtUsername" 
                    runat="server"                     
                    FieldLabel="用户名" 
                    AllowBlank="false"
                    BlankText="用户名不能为空." 
                    AnchorHorizontal="100%"
                    Text="" />
                <ext:TextField 
                    ID="txtPassword" 
                    runat="server" 
                    InputType="Password" 
                    FieldLabel="密码" 
                    AllowBlank="false" 
                    BlankText="密码不能为空."
                    AnchorHorizontal="100%"
                    Text="" />
            </Items>
            <Buttons>
                <ext:Button ID="btnLogin" runat="server" Text="登录" Icon="Accept">
                    <Listeners>
                        <Click Handler="
                            if (!#{txtUsername}.validate() || !#{txtPassword}.validate()) {
                                Ext.Msg.alert('错误','用户名和密码都不能为空!');
                                return false; 
                            }" />
                    </Listeners>
                    <DirectEvents>
                        <Click 
                        Url="/Account/LogOn/"
                        Timeout="60000"
                        CleanRequest="true"
                        Method="POST" 
                        Before="Ext.Msg.wait('正在登录...', '验证');"
                        Failure="Ext.Msg.show({
                           title:   '登录失败',
                           msg:     result.errorMessage,
                           buttons: Ext.Msg.OK,
                           icon:    Ext.MessageBox.ERROR
                        });"
                        >
                        </Click>
                    </DirectEvents>
                </ext:Button>
                <ext:Button ID="btnCancel" runat="server" Text="取消" Icon="Decline">
                   
                </ext:Button>
            </Buttons>
        </ext:Window>

    </form>
</body>
</html>